package Util;

import java.lang.reflect.Array;
import java.util.ArrayList;

import Entidades.Filial;

public class Controle {
	
	private static int filialNumero;
	private static ArrayList<String> ListaOnline;

	protected Controle(){

	}
	
	public static ArrayList<String> getListaOnline(){
		if (ListaOnline == null)
			ListaOnline = 	new ArrayList<String>();
		return ListaOnline;
	}
	
	public static int getFilialnumero(){
		return Filial.getInstance().getNumero();
	}	
	
	public static void setFilialnimero(int n){
		Filial.getInstance().setNumero(n);
	}
	
	
	public static String getServerAddress(int n){
		
		return "rmi://" + getServers()[n] + ":1099/Filial_" + n;
	}
	
	public static String getLocalAddress(){
		
		return "//" + getServers()[getFilialnumero()] + "/Filial_" + getFilialnumero();
	}
	
	public static String[] getServers(){
		
		String[] server = new String[11];
		server[0] = null;
		server[1] = "192.168.1.101";
		server[2] = "192.168.1.110";
		server[3] = "192.168.1.111";
		server[4] = "192.168.1.101";
		server[5] = "192.168.1.101";
		server[6] = "192.168.1.101";
		server[7] = "192.168.1.101";
		server[8] = "192.168.1.101";
		server[9] = "192.168.1.101";
		server[10] = "192.168.1.101";
		return server;
		
	}
}
